
import { createPinia } from "pinia"
// 插件
import { createPersistedState } from 'pinia-plugin-persistedstate'
export const storeKey = "yz-store";
// 导出全部模块
import { getParamsRequiredKeys } from './helper'
export { getParamsRequiredKeys }
export * from './modules/add-in-cart'
export * from './modules/auth'
export * from './modules/cart-summary' 
export * from './modules/subject'
export * from './modules/page-question-list'
export * from './modules/paper'
export * from './modules/question'
export * from './modules/router'
export * from './modules/user'
export * from './modules/paper'
/**
 * 安装并配置 Pinia 状态管理
 */
export function setupStore(app) {
    // 创建 Pinia 实例
    const pinia = createPinia()

    // 注册持久化插件
    pinia.use(createPersistedState({
        key: id => `${storeKey}-${id}`,
    }))
    // 将 Pinia 挂载到 Vue 应用
    app.use(pinia)
}

